﻿create procedure [dbo].[usp_PrintSqlError]
	
as
begin
    set nocount on;

    -- print SQL error information. 
    print 'Error ' + convert(varchar(50), ERROR_NUMBER()) +
          ', Severity ' + convert(varchar(5), ERROR_SEVERITY()) +
          ', State ' + convert(varchar(5), ERROR_STATE()) + 
          ', Procedure ' + isnull(ERROR_PROCEDURE(), '-') + 
          ', Line ' + convert(varchar(5), ERROR_LINE());
    print ERROR_MESSAGE();
end;